package com.xuxin.baby.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.baby.R;
import com.xuxin.baby.glide.GlideApp;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xu_xin
 * Created on 2020.08.04 0004
 * 课程
 */
public class MainClassAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public MainClassAdapter() {
        super(R.layout.item_main_class);
        List<String> list = new ArrayList<>();
        list.add("发育测评");
        list.add("0-1岁精婴早教必修课");
        list.add("早产儿专题早教课");
        list.add("高危儿筛查");
        setNewInstance(list);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, String item) {
        ImageView item_main_class_image = holder.getView(R.id.item_main_class_image);
        holder.setText(R.id.item_main_class_name, item);
        switch (item) {
            case "发育测评":
                GlideApp.with(getContext()).load(R.mipmap.img_class_evaluation).fitCenter().into(item_main_class_image);
                break;
            case "0-1岁精婴早教必修课":
                GlideApp.with(getContext()).load(R.mipmap.img_class_required).fitCenter().into(item_main_class_image);
                break;
            case "早产儿专题早教课":
                GlideApp.with(getContext()).load(R.mipmap.img_class_premature).fitCenter().into(item_main_class_image);
                break;
            case "高危儿筛查":
                GlideApp.with(getContext()).load(R.mipmap.img_class_risk).fitCenter().into(item_main_class_image);
                break;
        }
    }
}